package com.funong.matrix.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum ModuleType {
    /**
     * 模块状态
     */
    DEFAULT("default", "默认"),
    USER("user", "用户模块"),
    LOGIN("login", "登录模块"),
    COMPANY("company", "公司模块"),
    DEPARTMENT("department", "部门模块"),
    ROLE("role", "角色模块"),
    POWER("power", "权限模块"),
    MENU("menu", "菜单模块"),
    USER_ROLE("user_role", "用户角色模块"),
    ROLE_POWER("role_power", "角色权限模块"),
    ROLE_MENU("role_menu", "角色菜单模块"),
    USER_TAG("user_tag", "标签模块"),
    CONFIG("config","系统参数配置模块"),
    DICT("dict","数据字典模块"),
    MSG("msg","消息模块"),
    LOG("log","日志模块"),


    ;

    private String module;
    private String desc;

    public static ModuleType getModule(String module) {
        return Arrays.stream(values())
                .filter(moduleType -> StringUtils.equals(module, moduleType.getModule()))
                .findFirst()
                .orElse(DEFAULT);
    }
}
